package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Tel      string `gorm:"type:varchar(30);not null;comment: 手机号"`
	Password string `gorm:"type:char(32);not null;comment: 密码"`
}

func (u *User) Register(db *gorm.DB, tel string) error {
	return db.Debug().Where("tel = ?", tel).FirstOrCreate(u).Error
}
